/**
 * <h3>CooperationServiceImpl</h3>
 * <p> 文创合作服务实现类 </p>
 *
 * <h3>功能描述</h3>
 * <p> 实现了 {@link ICooperationService} 接口中定义的文创合作信息增删改查业务逻辑 </p>
 * <p> 通过调用 {@link CooperationMapper} 完成对数据库的操作，支持条件查询、按ID查询、更新、新增和删除等操作 </p>
 *
 * <h3>元数据</h3>
 * <ul>
 *    <li> 作者：郭强</li>
 *    <li> 创建日期：2025年05月17日 14:34:42 </li>
 * </ul>
 *
 * <h3>其他信息</h3>
 * <ul>
 *    <li> 参考链接：<a href="https://example.com">官方网页</a></li>
 *    <li> 示例代码：{@code new CooperationServiceImpl()} </li>
 * </ul>
 *
 * @apiNote 该类基于 MyBatis Plus 的 ServiceImpl 实现，需确保 CooperationMapper 正确注入
 * @implSpec 继承自 {@link ServiceImpl<CooperationMapper, CooperationDTO>} 并实现 {@link ICooperationService} 接口
 * @since 1.0.0
 */

package com.dnndo.system.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dnndo.system.domain.Cooperation;
import com.dnndo.system.domain.dto.CooperationDTO;
import com.dnndo.system.mapper.CooperationMapper;
import com.dnndo.system.service.ICooperationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 文创合作服务实现类
 */
@Service
public class CooperationServiceImpl extends ServiceImpl<CooperationMapper, CooperationDTO> implements ICooperationService {

    private final CooperationMapper cooperationMapper;

    @Autowired
    public CooperationServiceImpl(CooperationMapper cooperationMapper) {
        this.cooperationMapper = cooperationMapper;
    }

    @Override
    public List<Cooperation> selectCooperationList(CooperationDTO dto) {
        return cooperationMapper.selectCooperationList(dto);
    }

    @Override
    public CooperationDTO selectCooperationById(Long cooperateId) {
        return cooperationMapper.selectCooperationListById(cooperateId);
    }

    @Override
    public int updateCooperationById(CooperationDTO cooperateDTO) {
        return cooperationMapper.updateCooperationById(cooperateDTO);
    }

    @Override
    public int insertCooperation(CooperationDTO cooperateDTO) {
        cooperateDTO.setContact(0);
        return cooperationMapper.insertCooperation(cooperateDTO);
    }

    @Override
    public int deleteCooperationById(Integer cooperateId) {
        return cooperationMapper.deleteCooperationById(cooperateId);
    }
}
